import imghdr
import os
import sys

args = sys.argv

arg_num = len(args)

if arg_num == 1:
    print('nothing')
    sys.exit(0)

base_dir = os.getcwd()

for i,arg in enumerate(args):
    if i == 1:
        filename = args[1]
    elif i == 2:
        base_dir = args[2]

file_path = os.path.join(base_dir, filename)

# imghdr 可以用来判断文件是否是图片
what = imghdr.what(file_path)
print(what)